import { createRouter, createWebHashHistory } from "vue-router";
import HomeView from '@/components/HelloWorld.vue'
import Login from '../views/Login.vue'
import NotFoundPage from '@/views/404.vue'
// 定义路由匹配机制
const routes = [
    {
        path: '/', 
        redirect: '/home'
    },
    {
        path: '/home', 
        component: HomeView
    },
    {
        path: '/login', 
        component: Login
    },
    // 捕获404路由
    {
        path: '/:pathMatch(.*)*',
        name: 'NotFound',
        component: NotFoundPage
    }
]
// 创建路由实例对象
const router = createRouter({
    history: createWebHashHistory(),
    routes
})
export default router